﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DotNetMVC.DTO;
using DotNetMVC.Model;

namespace DotNetMVC.IService
{
    public partial interface IPermissionService : IBaseService<Permission>
    {
        /// <summary>
        /// 权限名称是否存在
        /// </summary>
        /// <param name="permName"></param>
        /// <returns></returns>
        bool Exist(string name);

        PermissionDTO[] GetPermissions();

        /// <summary>
        /// 获取管理员权限菜单
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        PermissionDTO[] GetPermMenusByUserId(long userId);

        /// <summary>
        /// 递归获取权限
        /// </summary>
        /// <param name="navLevel">权限级数， 不指定，默认返回全部</param>
        /// <returns></returns>
        List<PermissionDTO> GetPermissionsByLevel(int navLevel = 0);

        PermissionDTO GetDTOById(long id);

        PermissionDTO[] GetPermissionByRoleId(long roleId);

        void Add(PermissionDTO modelParentPermission, string name, bool isMenu, string menuIcon, string description, string controllerName, string actionName, string httpMethod);
        void Update(long id, PermissionDTO modelParentPermission, string name, bool isMenu, string menuIcon, string description, string controllerName, string actionName, string httpMethod);

    }
}
